package com.example.seata.order.advice;

import lombok.extern.slf4j.Slf4j;
import org.example.common.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName : ControllerAdvice
 * @Description : 统一异常切面
 * @Author : tianshuo
 * @Date: 2021-05-15 20:18
 */
@Slf4j
@ControllerAdvice
public class GlobalExceptionHandler {

    @ResponseBody
    @ExceptionHandler(Exception.class)
    public Result error(Exception ex) {
        log.error("系统异常：{}",ex);
        return Result.error();
    }
}

